<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
	"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<%-- Include common set of tag library declarations for each layout --%>
<%@ page language="java" pageEncoding="UTF-8" contentType="text/html; charset=utf-8" errorPage="/error.jsp" isELIgnored="false" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-tiles" prefix="tiles" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.opensymphony.com/oscache" prefix="cache" %>
<%@ taglib uri="http://atleap.blandware.com/taglib" prefix="atleap" %>
<html:xhtml />

<atleap:constants className="com.blandware.atleap.webapp.struts.ContentTilesRequestProcessor" var="IS_NOCACHE" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="DISPLAYED_OBJECT_TITLE_KEY" scope="page" />
<atleap:constants className="com.blandware.atleap.webapp.util.core.WebappConstants" var="DISPLAYED_OBJECT_URI_KEY" scope="page" />

<c:set var="displayedObjectTitle" value="${requestScope[pageScope.DISPLAYED_OBJECT_TITLE_KEY]}" />
<c:set var="displayedObjectUri" value="${requestScope[pageScope.DISPLAYED_OBJECT_URI_KEY]}" />

<html:html xhtml="true">
	<head>
		<c:if test="${!empty requestScope[pageScope.IS_NOCACHE]}">
          <meta http-equiv="Cache-Control" content="no-cache,no-store,max-age=0"/>
          <meta http-equiv="Pragma" content="no-cache"/>
		</c:if>

        <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
        <c:set var="ctxPath" value="${pageContext.request.contextPath}" scope="request"/>

        <meta name="author" content="Andrey Grebnev" />
        <meta name="copyright" content="Copyright (c) 2002-2008 Blandware http://www.blandware.com" />
        <meta name="publisher" content="Blandware http://www.blandware.com" />
        <meta name="robots" content="index,follow" />

        <!-- Links to syndication feeds -->
        <link rel="alternate" type="application/rss+xml" href="<atleap:rewriteUrl action="syndication/lastChanges_rss_2.0.do"/>" />
        <link rel="alternate" type="application/rss+xml" href="<atleap:rewriteUrl action="syndication/news_rss_2.0.do"/>" />

        <!-- Description and Keywords -->
		<atleap:content identifier="description" var="description" editable="false" />
		<c:if test="${!empty description}">
			<meta name="description" content="${description}" />
		</c:if>

		<atleap:content identifier="keywords" var="keywords" editable="false" />
		<c:if test="${!empty keywords}">
			<meta name="keywords" content="${keywords}" />
		</c:if>

		<atleap:base />

		<%-- Push tiles attributes in page context --%>
		<tiles:importAttribute ignore="true"/>
		<title>
            <atleap:message key="core.commons.webapp.prefix"/>
            <c:choose>
                <c:when test="${!empty displayedObjectTitle}">
                    <c:out value="${displayedObjectTitle}" escapeXml="true" />
                </c:when>
                <c:when test="${!empty displayedObjectUri}">
                    <atleap:content identifier="title" ignore="true" editable="false" uri="${displayedObjectUri}" />
                </c:when>
                <c:when test="${!empty titleKey}">
                    <atleap:message key="${titleKey}"/>
                </c:when>
                <c:otherwise>
                    <atleap:content identifier="title" ignore="true" editable="false" />
                </c:otherwise>
            </c:choose>
        </title>

        <%-- Get list of global Javascripts (scripts used on the most of pages or even on every page) --%>
        <tiles:useAttribute id="layoutScriptList" name="layoutScripts" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="js" items="${layoutScriptList}">
            <script type="text/javascript" src="<atleap:rewriteUrl href="${js}" />"></script>
        </atleap:iterator>

        <%-- Get list of local Javascripts (scripts used on concrete page, built on this layout) --%>
        <tiles:useAttribute id="pageScriptList" name="pageScripts" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="js" items="${pageScriptList}">
            <script type="text/javascript" src="<atleap:rewriteUrl href="${js}" />"></script>
        </atleap:iterator>

        <%-- Get list of global Stylesheets --%>
        <tiles:useAttribute id="layoutStyleList" name="layoutStyles" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="css" items="${layoutStyleList}">
            <link rel="stylesheet" type="text/css" media="all" href="<atleap:rewriteUrl href="${css}" />" />
        </atleap:iterator>

        <%-- Get list of local Stylesheets --%>
        <tiles:useAttribute id="pageStyleList" name="pageStyles" classname="java.util.List" ignore="true"/>

        <atleap:iterator var="css" items="${pageStyleList}">
            <link rel="stylesheet" type="text/css" media="all" href="<atleap:rewriteUrl href="${css}" />" />
        </atleap:iterator>

        <%-- Get List of Print Stylesheets --%>
        <tiles:useAttribute id="printList" name="printStyles" classname="java.util.List" ignore="true"/>
        
        <atleap:iterator var="css" items="${printList}">
            <link rel="stylesheet" type="text/css" media="print" href="<atleap:rewriteUrl href="${css}" />" />
        </atleap:iterator>

        <link rel="SHORTCUT ICON" href="<atleap:rewriteUrl href="/favicon.ico"/>" />

        <%-- Inserting code that allows to collect statistics --%>
        <atleap:collectStats />

    </head>

    <body>

        <tiles:useAttribute id="leftLayoutBlocks" name="leftLayoutBlocksList" classname="java.util.List" ignore="true"/>
        <tiles:useAttribute id="leftLayoutIndexedBlocks" name="leftLayoutIndexedBlocksList" classname="java.util.List" ignore="true"/>
        <tiles:useAttribute id="leftPageBlocks" name="leftPageBlocksList" classname="java.util.List" ignore="true"/>
        <tiles:useAttribute id="rightLayoutBlocks" name="rightLayoutBlocksList" classname="java.util.List" ignore="true"/>
        <tiles:useAttribute id="rightLayoutIndexedBlocks" name="rightLayoutIndexedBlocksList" classname="java.util.List" ignore="true"/>
        <tiles:useAttribute id="rightPageBlocks" name="rightPageBlocksList" classname="java.util.List" ignore="true"/>


        <table width="100%" border="0" cellpadding="0" cellspacing="0" class="basetable">
            <tr class="noBorder">
                <td colspan="3" id="header" align="center" nowrap="nowrap">
                    <atleap:content identifier="header" />
                </td>
            </tr>
            <tr class="noBorder">
                <td class="noBorder" id="leftColumn" align="left">
                    <atleap:iterator items="${leftLayoutBlocks}" var="layoutBlock">
						<tiles:insert definition="${layoutBlock}" />
                    </atleap:iterator>
                    <atleap:iterator items="${leftPageBlocks}" var="pageBlock">
						<tiles:insert name="${pageBlock.definition}" />
                    </atleap:iterator>

                    <atleap:iterator items="${leftLayoutIndexedBlocks}" var="definition">
						<tiles:insert definition="${definition}" />
                    </atleap:iterator>
                </td>
                <td class="noBorder" align="left" id="centerColumn">
                    <h2>
                        <c:choose>
                            <c:when test="${!empty displayedObjectTitle}">
                                <c:out value="${displayedObjectTitle}" escapeXml="true" />
                            </c:when>
                            <c:when test="${!empty displayedObjectUri}">
                                <atleap:content identifier="title" ignore="true" uri="${displayedObjectUri}" />
                            </c:when>
                            <c:when test="${!empty titleKey}">
                                <atleap:message key="${titleKey}"/>
                            </c:when>
                            <c:otherwise>
                                <atleap:content identifier="title" ignore="true" />
                            </c:otherwise>
                        </c:choose>
                    </h2>
                    <br />
                    <tiles:get name="content" />
                </td>
                <td class="noBorder" id="rightColumn" align="right">
                    <atleap:iterator items="${rightLayoutBlocks}" var="layoutBlock">
						<tiles:insert definition="${layoutBlock}" />
                    </atleap:iterator>
                    <atleap:iterator items="${rightPageBlocks}" var="pageBlock">
						<tiles:insert name="${pageBlock.definition}" />
                    </atleap:iterator>

                    <atleap:iterator items="${rightLayoutIndexedBlocks}" var="definition">
						<tiles:insert definition="${definition}" />
                    </atleap:iterator>
                </td>
            </tr>
            <tr class="noBorder">
                <td colspan="3" id="footer"><atleap:content identifier="footer" /></td>
            </tr>
        </table>
     </body>

</html:html>
